import { ReactElement, useContext } from 'react'
import { Row, Col, Form, Input } from 'antd'
import style from './index.module.less'
import { Context } from '../../context'
import UnitNumberInput from '@components/unitNumberInput'
import TextCell from '@src/components/textCell'

const { Item } = Form
const { TextArea } = Input

function Main (): ReactElement {
  const { caseDetail: d } = useContext(Context)
  const disabled = d !== null && ['已确认', '抽查中', '已抽查'].includes(d.score_status)
  return (
    <div className={style.container} id='inputBlockThree'>
      <div className={style.title}>办案质量</div>
      <Row>
        <Col span={20}>
          <Item label='1. 违反工作规范/服务态度恶劣被投诉'>
            <Row gutter={8}>
              <Col flex='auto'>
                <Item name='break_rule_desc' noStyle>
                  {disabled ? <TextCell /> : <TextArea placeholder='请输入' rows={2} allowClear />}
                </Item>
              </Col>
              <Col flex='160px'>
                <Item name='break_rule_count' noStyle>
                  {disabled ? <TextCell unit='次' /> : <UnitNumberInput />}
                </Item>
              </Col>
            </Row>
          </Item>
        </Col>
        <Col span={20}>
          <Item label='2. 发现仲裁程序问题并提示纠正'>
            <Row gutter={8}>
              <Col flex='auto'>
                <Item name='fix_arbprocedure_desc' noStyle>
                  {disabled ? <TextCell /> : <TextArea placeholder='请输入' rows={2} allowClear />}
                </Item>
              </Col>
              <Col flex='160px'>
                <Item name='fix_arbprocedure_score' noStyle>
                  {disabled ? <TextCell unit='分' /> : <UnitNumberInput />}
                </Item>
              </Col>
            </Row>
          </Item>
        </Col>
        <Col span={20}>
          <Item label='3. 发现仲裁庭忽略的实体问题予以提示和纠正 '>
            <Row gutter={8}>
              <Col flex='auto'>
                <Item name='fix_arbtity_desc' noStyle>
                  {disabled ? <TextCell /> : <TextArea placeholder='请输入' rows={2} allowClear />}
                </Item>
              </Col>
              <Col flex='160px'>
                <Item name='fix_arbtity_score' noStyle>
                  {disabled ? <TextCell unit='分'/> : <UnitNumberInput />}
                </Item>
              </Col>
            </Row>
          </Item>
        </Col>
      </Row>
    </div>
  )
}

export default Main
